package com.spring.starter;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * @program week05
 * @description: auto
 * @author: chanzhugang
 * @create: 2021/04/18 17:51
 */
@Configuration
@Import(StudentConfiguration.class)
@EnableConfigurationProperties(StudentProperties.class)
public class StudentAutoConfiguration {

    @Autowired
    StudentProperties properties;

    @Autowired
    StudentConfiguration configuration;

    @Bean
    public Student student() {
        return new Student(configuration.name + ":"+ properties.getName());
    }
}